package com.mew.chess.core.game.pokdeng.game.message;

import com.mew.chess.core.game.pokdeng.game.PokDengSeatManager;
import com.zebra.common.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import lombok.*;

/**
 * @author dylin
 * @create 2021/5/7
 */
@Data
@ToString
public class PaymentMessage {
    private int seatNo;//座位号
    private long payment;//赔付
    private long goldNumber;//背包金币
    public void write(ByteBuf b) {
        ByteBufUtils.writeInt(b,seatNo);
        ByteBufUtils.writeLong(b,payment);
        ByteBufUtils.writeLong(b,goldNumber);
    }
    public static PaymentMessage buildPayment(PokDengSeatManager seat){
        PaymentMessage message=new PaymentMessage();
        message.setSeatNo(seat.getSeatNo());
        message.setPayment(seat.getUser().getPayment());
        message.setGoldNumber(seat.getUser().getGoldNumber());
        return message;
    }
}
